import concurrent.futures
import logging
from pathlib import Path

import pytest

from tools.page import page_get
from 数据获取.退件订单导出不拆分 import 退件订单导出不拆分
from 数据获取.退件订单导出拆分 import 退件订单导出拆分

@pytest.mark.flaky(reruns=1, reruns_delay=2, reruns_show_all=True)
def 聚水潭导出_test(date_hour, timestamp):
    with concurrent.futures.ThreadPoolExecutor() as executor:
        page1 = page_get(9230, r'C:\\Chromedata_退件订单不拆分')
        page2 = page_get(9231, r'C:\\Chromedata_退件订单拆分')
        # 提交任务到线程池
        future1 = executor.submit(退件订单导出不拆分, page1, date_hour, timestamp)
        future2 = executor.submit(退件订单导出拆分, page2, date_hour)
        concurrent.futures.wait([future1, future2])
        result1 = future1.result()
        result2 = future2.result()
        assert result1, result2 == True
